fix(memtrack): prompt sudo on interactive stdin#459
Open
not-matthias wants to merge 2 commits into
Open
Conversation
Greptile SummaryThis PR fixes sudo prompting for memtrack runs when stdio is redirected. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (3): Last reviewed commit: "fix(memtrack): detect sudo prompts via c..." | Re-trigger Greptile |
Merging this PR will not alter performance
|
not-matthias
force-pushed
the
cod-3153-memtrack-sudo-password-prompt-skipped-when-stdout-is
branch
from
July 21, 2026 18:21
50c3e26 to
8c8e200
Compare
not-matthias
marked this pull request as ready for review
July 21, 2026 18:22
Use the controlling input terminal to decide whether sudo can prompt for a password. Keep the non-interactive wrapper safe after credentials are validated.\n\nFixes COD-3153
Use /dev/tty so piped stdin still prompts when a controlling terminal is available. Add a Bash regression covering piped stdin and redirected stdout.\n\nRefs COD-3153
not-matthias
force-pushed
the
cod-3153-memtrack-sudo-password-prompt-skipped-when-stdout-is
branch
from
July 21, 2026 18:22
8c8e200 to
2915940
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
validate_sudo_accesspreviously checked stdin/stdout directly, so both redirected output and piped input could skip the password prompt even when the process still had a controlling terminal. The subsequent non-interactive sudo command then failed when credentials were not cached.Use
/dev/ttyto detect whether sudo can prompt through the controlling terminal. Add a Linux integration test that launches a real Bash command with piped stdin and redirected stdout, then verifies a fake sudo receives--validatebefore the non-interactive command.Fixes COD-3153